Introduction

This alarm project is done to make you wakeup and move from your bed to switch it off. A ball going to fall dawn from the alarm when it start peeping, and to switch it off you need to find the ball in put it back inside its bath in the alarm box. And for decoration purposes the alarm been made as it a floor light and added I light inside the alarm box.

 

How it work

By an application that I created it in App inventor 2, to communicate with the alarm by bluetooth to set the time for the alarm. When it is the time for the alarm to start the servo motor which work as holder for the ball will move to give space for the ball to fall dawn, then the IR sensor will detect that the ball is not there and the buzzer well start bee-piping. Then I find the ball and I put it back inside its path in the alarm box, so the IR sensor will detect the ball is their and then buzzer will stop pee-ping .

 

Input

IR Sensor is the input where it will give the order to the buzzer to start and stop when it detect the ball is not their and when its detect that the ball is their respectively.

Output

The servo motor where it hold the ball from falling dawn, it will resieve a signal from the board (At-tiny) to move when it is the stetted alarm time. And go back to it is place to hold the ball when puting it back inside its path in the box.

 

 

Bluetooth

For testing purposes for the bluetooth device. I downloaded application called Bluetooth Terminal from Samsung play store to test the connection. Open the app → connect to the bluetooth device → to set the time I type *10 ← this number represent seconds. For example, if I want the alarm to start after one minute from now I type *60. After I test the bluetooth device and make sure is it working I developed program in App inventor 2 to set the alarm time via bluetooth with a good interface.

 

 

Application development

In App inventor I developed application to set the alarm time by minute.

 

 

App Interface

 

 

Block

 

 

Bill of Materials

 

Servo Motor

 

Bluetooth Device to communicate with the alarm

 

IR Sensor to detect the ball and switch off the alarm

 

Attiny84

 

Copper plate

 

Wood plate for the box

 

 

My Work:-

Board:

I used eaglecad to do my schematic design and printed it on the copper board and soldering the component. I used attiny44 put replaced it later the space wasn’t enough for the program code.

Electronics:

After soldering the board I connect my electronics to the board ( Bluetooth, servo motor, IR sensor ) and tested it.

Boxing:

For the boxing part I used two material (wood for main structure-acrylic for decoration). In Onshape I designed the wood box and make some rectangle holes in it, as I want to add I light later to use it also as floor light (design purposes). Using CNC machine I finish my box cutting and countinue to the lazer cutter to do the Acrylic cutting.

 

Project license

I will use Creative Common with the following:

- Attribution (BY) - Non Commercial (NC).

- No Derivative Works (ND).

I choose this kind of license as it has benefits for the owner and forbids the commercial use for the product.

 

 

Assemling

 

Programing

 

#include <SoftwareSerial.h>
#include "SoftwareServo.h"
#define buzzer 7
#define sensor 6
char c;
String str;
unsigned long time;
unsigned long alarmTime = 999999;
int pos;
SoftwareServo myservo;


SoftwareSerial mySerial(3, 1); // RX, TX

void setup() {
mySerial.begin(9600);
time = millis();
pinMode(buzzer, OUTPUT);
myservo.attach(0);

 

for (pos = 90; pos > 0; pos -= 2)
{
myservo.write(pos);
delay(15);
SoftwareServo::refresh();
}
// for (pos = 0; pos < 90; pos += 2)
// {
// myservo.write(pos);
// delay(15);
// SoftwareServo::refresh();
// }

}
void loop() { // run over and over
while (mySerial.available() <= 0) {
if (alarmTime != 999999) { //alarm set
if ((millis() - time) >= (alarmTime * 60000)) {
alarmTime = 999999;
digitalWrite(buzzer, HIGH);
delay(1000);
digitalWrite(buzzer, LOW);
delay(300);
for (pos = 0; pos < 90; pos += 2) //open servo
{
myservo.write(pos);
delay(15);
SoftwareServo::refresh();
}
delay(2000);
for (pos = 90; pos > 0; pos -= 2)
{
myservo.write(pos);
delay(15);
SoftwareServo::refresh();
}
while (analogRead(sensor) > 100) {
//while (1) {
digitalWrite(buzzer, HIGH);
delay(700);
digitalWrite(buzzer, LOW);
delay(300);
}
}
}
}

c = mySerial.read();
if (c == '*') { //valid data
while (mySerial.available() <= 0);
str = mySerial.readString();
delay(200);
alarmTime = str.toInt();
digitalWrite(buzzer, HIGH);
delay(500);
digitalWrite(buzzer, LOW);
delay(200);
digitalWrite(buzzer, HIGH);
delay(100);
digitalWrite(buzzer, LOW);
time = millis();
}
}

 

Board Sch File

 

Board Brd File

 

3D ball file

 

Phone App

 

Box file (Onshape)